using System.Web.Management ;

namespace OpenLightGroup.Common.ApplicationServices
{
    /// <summary>
    /// Used as a base class to allow for easier configuration.
    /// </summary>
    /// <remarks>
    /// Both constructors shown below are needed so that the WebEvent API 
    /// can see that this type should be handled as an WebBaseEvent
    /// </remarks>
    public abstract class GeneralEvent : WebBaseEvent
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="GeneralEvent" /> class.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="eventSource">The event source.</param>
        /// <param name="eventCode">The event code.</param>
        /// <param name="eventDetailCode">The event detail code.</param>
        protected GeneralEvent ( string message,
                                object eventSource,
                                int eventCode,
                                int eventDetailCode )
        : base ( message, eventSource, eventCode, eventDetailCode )
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="GeneralEvent" /> class.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="eventSource">The event source.</param>
        /// <param name="eventCode">The event code.</param>
        protected GeneralEvent ( string message, object eventSource, int eventCode )
        : base ( message, eventSource, eventCode )
        {
        }

        /// <summary>
        /// Formats the custom event details.
        /// </summary>
        /// <param name="formatter">The formatter.</param>
        public override void FormatCustomEventDetails ( WebEventFormatter formatter )
        {
            base.FormatCustomEventDetails ( formatter ) ;

            formatter.AppendLine ( "Type: " + this.GetType ( ).ToString ( ) ) ;
        }
    }
}